package com.springboot.project.common.service.impl;

import com.springboot.project.common.entity.User;
import com.springboot.project.common.dao.UserDao;
import com.springboot.project.common.service.UserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 管理员表 服务实现类
 * </p>
 *
 * @author lby
 * @since 2018-03-24
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserService {

    @Override
    public User getUserByName(String userName)
    {
        return baseMapper.getUserByName(userName);
    }

    @Override
    public String getRoleNameById(int roleId) {
        return baseMapper.getRoleNameById(roleId);
    }

    @Override
    public List<User> selectUser(Map<String, Object> map) {
        return baseMapper.selectUser(map);
    }

    @Override
    public boolean exit(Map<String, Object> params) {
        List<User> users = baseMapper.selectUser(params);
        if(users.size() > 0)
        {
            return true;
        }
        return false;
    }

    @Override
    public int editUser(User user) {
        return baseMapper.editUser(user);
    }

    @Override
    public int resetPassword(int id, String password) {
        return baseMapper.resetPassword(id, password);
    }

    @Override
    public int count(Map<String, Object> map) {
        return baseMapper.count(map);
    }
}
